package so.wy.servicecenter.businessbed.service.hospital.dto;

import lombok.Data;
import lombok.NoArgsConstructor;
import so.wy.servicecenter.businessbed.dao.rdb.hospital.hospital_price.HospitalPriceDO;

import java.math.BigDecimal;

/**
 * @author wdl
 * @date 2020-04-08
 */
@Data
@NoArgsConstructor
public class HospitalPriceDTO {

    /**
     * 主键ID
     */
    private Long id;
    /**
     * 医院ID
     */
    private Long hospitalId;
    /**
     * 医院名称
     */
    private String hospitalName;
    /**
     * 1周期 2起始+后续
     */
    private Integer priceType;
    /**
     * 起始小时数
     */
    private Integer priceStartHour;
    /**
     * 起始价格
     */
    private BigDecimal priceStartMoney;
    /**
     * 后续每小时价格
     */
    private BigDecimal priceAfterMoney;
    /**
     * 计费描述
     */
    private String priceDesc;
    /**
     * 是否启用
     */
    private Integer isOpen;
    /**
     * 排序
     */
    private Integer sortNum;

    public HospitalPriceDTO(HospitalPriceDO hospitalPriceDO) {
        if (hospitalPriceDO == null) {
            return;
        }

        this.id = hospitalPriceDO.getId();
        this.hospitalId = hospitalPriceDO.getHospitalId();
        this.hospitalName = hospitalPriceDO.getHospitalName();
        this.priceType = hospitalPriceDO.getPriceType();
        this.priceStartHour = hospitalPriceDO.getPriceStartHour();
        this.priceStartMoney = hospitalPriceDO.getPriceStartMoney();
        this.priceAfterMoney = hospitalPriceDO.getPriceAfterMoney();
        this.priceDesc = hospitalPriceDO.getPriceDesc();
        this.isOpen = hospitalPriceDO.getIsOpen();
        this.sortNum = hospitalPriceDO.getSortNum();
    }

    public HospitalPriceDO convert2DO() {
        HospitalPriceDO hospitalPriceDO = new HospitalPriceDO();
        hospitalPriceDO.setId(this.id);
        hospitalPriceDO.setHospitalId(this.hospitalId);
        hospitalPriceDO.setHospitalName(this.hospitalName);
        hospitalPriceDO.setPriceType(this.priceType);
        hospitalPriceDO.setPriceStartHour(this.priceStartHour);
        hospitalPriceDO.setPriceStartMoney(this.priceStartMoney);
        hospitalPriceDO.setPriceAfterMoney(this.priceAfterMoney);
        hospitalPriceDO.setPriceDesc(this.priceDesc);
        hospitalPriceDO.setIsOpen(this.isOpen);
        hospitalPriceDO.setSortNum(this.sortNum);
        return hospitalPriceDO;
    }

}
